Skip to content

fix(util-endpoints): reject non-ASCII input in substring per Smithy spec#1880

Merged
kuhe merged 2 commits intosmithy-lang:mainfrom
TrevorBurnham:handle-non-ascii
Feb 24, 2026
Merged

fix(util-endpoints): reject non-ASCII input in substring per Smithy spec#1880
kuhe merged 2 commits intosmithy-lang:mainfrom
TrevorBurnham:handle-non-ascii

Conversation

@TrevorBurnham
Copy link
Contributor

Issue #, if available:

Fixes #1097

Description of changes:

The substring function in @smithy/util-endpoints did not reject inputs containing non-ASCII characters, which is required by the Smithy spec:

The function MUST return an empty optional when the input contains non-ASCII characters.

The fix adds a /[^\u0000-\u007f]/ check to the early-return guard, returning null for any input outside the ASCII range. Test cases added for \u0080, accented, and CJK characters.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@TrevorBurnham TrevorBurnham requested a review from a team as a code owner February 21, 2026 01:29
@kuhe kuhe merged commit 2bf677c into smithy-lang:main Feb 24, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

util-endpoints: substring allows non-ASCII characters

2 participants